package fr.inria.zvtm.engine;

import fr.inria.zvtm.glyphs.Glyph;

public class Dragger {
	protected Glyph draggedGlyph;
	protected View view;
	
	public Dragger(View view) {
		super();
		this.view = view;
	}

	public void startDrag(Glyph g) {
		this.draggedGlyph = g;
	}
	
	public Glyph drag() {
		VCursor c = view.getCursor();
		draggedGlyph.move(c.vx-c.pvx, c.vy-c.pvy);
		return draggedGlyph;
	}
	
	public Glyph endDrag() {
		Glyph g = draggedGlyph;
		draggedGlyph = null;
		return g;
	}
}
